<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::get('/', 'HomeController@index');
Route::get('games', 'GameController@index');
Route::get('games/latest', 'GameController@latest');
Route::get('games/hot', 'GameController@hot');
Route::get('games/cat/{category?}', 'GameController@cat');
Route::get('games/show/{id}', 'GameController@show');
Route::get('games/download/{id}', 'GameController@download');

Route::get('configs/{id}', 'ConfigController@show');

Route::get('unlock/{source}', 'HomeController@unlock');

// Authentication routes...
Route::get('auth/login', 'Auth\AuthController@getLogin');
Route::post('auth/login', 'Auth\AuthController@postLogin');
Route::get('auth/logout', 'Auth\AuthController@getLogout');

// Registration routes...
Route::get('auth/register', 'Auth\AuthController@getRegister');
Route::post('auth/register', 'Auth\AuthController@postRegister');



Route::group(['prefix' => 'admin', 'middleware' => ['auth'], 'namespace' => 'Admin'], function () {

    Route::get('/', function () {
        return redirect('admin/home');
    });
    Route::get('home', 'HomeController@home');

    Route::post('games/process', 'GameController@process');
    Route::resource('games', 'GameController');

    Route::post('categories/process', 'CategoryController@process');
    Route::resource('categories', 'CategoryController');

    Route::post('configs/process', 'ConfigController@process');
    Route::resource('configs', 'ConfigController');


});